﻿<%@ page import="dao.AreaDao" %>
<%@ page import="bean.Area" %>
<%@ page import="bean.People" %>
<%@ page import="java.util.List" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta content="" name="description"/>
    <meta content="webthemez" name="author"/>
    <title>区域管理</title>
    <!-- Bootstrap Styles-->
    <link href="assets/css/bootstrap.css" rel="stylesheet"/>
    <!-- FontAwesome Styles-->
    <link href="assets/css/font-awesome.css" rel="stylesheet"/>
    <!-- Morris Chart Styles-->

    <!-- Custom Styles-->
    <link href="assets/css/custom-styles.css" rel="stylesheet"/>
    <!-- Google Fonts-->
    <link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'/>
    <!-- TABLE STYLES-->
    <link href="assets/js/dataTables/dataTables.bootstrap.css" rel="stylesheet"/>

    <style>
        .pull-right-margin {
            margin: 20px;
        }

    </style>
</head>
<jsp:include page="weather.jsp"/>
<body>
<div id="wrapper">
    <jsp:include page="header.jsp"/>
    <!--/. NAV TOP  -->
    <nav class="navbar-default navbar-side" role="navigation">
        <div class="sidebar-collapse">
            <ul class="nav" id="main-menu">
                <li>
                    <a href="index.jsp"><i class="fa fa-dashboard"></i> 主控制面板</a>
                </li>
                <li>
                    <a href="peopleManger.jsp"><i class="glyphicon glyphicon-user"></i>人员管理</a>
                </li>

                <li>
                    <a href="salaryManager.jsp"><i class="fa fa-sitemap"></i>薪水管理</a>
                </li>
                <li>
                    <a href="taskManager.jsp"><i class="fa fa-qrcode"></i>任务管理</a>
                </li>

                <li>
                    <a href="areaManager.jsp" class="active-menu"><i class="fa fa-table"></i> 区域管理</a>
                </li>
                <li>
                    <a href="stateManager.jsp"><i class="fa fa-edit"></i> 状态管理 </a>
                </li>
            </ul>

        </div>

    </nav>
    <!-- /. NAV SIDE  -->
    <div id="page-wrapper">
        <div class="header">
            <h1 class="page-header">
                区域管理
            </h1>
        </div>

        <div id="page-inner">

            <div class="row">
                <div class="col-md-12">
                    <div class="row">
                        <div class="pull-right pull-right-margin">
                            <button class="btn btn-success" data-toggle="modal" data-target="#areaAddModal">
                                添加
                            </button>
                            <!-- 模态框（Modal） -->

                            <div class="modal fade" id="areaAddModal" tabindex="-1" role="dialog"
                                 aria-labelledby="myModalLabel"
                                 aria-hidden="true">
                                <div class="modal-dialog">

                                    <div class="modal-content">
                                        <div class="modal-header">
                                            <button type="button" class="close" data-dismiss="modal"
                                                    aria-hidden="true">
                                            </button>
                                            <h4 class="modal-title" id="myModalLabel">
                                                添加区域信息
                                            </h4>
                                        </div>
                                        <form action="addArea" class="form-group">
                                            <div class="modal-body">
                                                <%--表单信息--%>
                                                <div class="form-group">
                                                    <label for="areaName">区域名称</label>
                                                    <input type="text" class="form-control" id="areaName"
                                                           name="areaName"
                                                           placeholder="区域名称">
                                                </div>

                                            </div>
                                            <div class="modal-footer">
                                                <button type="button" class="btn btn-default" data-dismiss="modal">
                                                    关闭
                                                </button>
                                                <button type="submit" class="btn btn-primary">
                                                    添加
                                                </button>
                                            </div>
                                        </form>
                                    </div>
                                    <!-- /.modal-content -->
                                </div><!-- /.modal-dialog -->
                            </div><!-- /.modal -->
                            <script>
                                $(function () {
                                    $('#areaAddModal').modal('hide')
                                });
                            </script>

                        </div>
                    </div>

                    <table class="table">
                        <tr>
                            <td>编号</td>
                            <td>区域名</td>
                            <td>操作</td>

                        </tr>
                        <%
                            AreaDao areaDao = new AreaDao();
                            List<Area> list = areaDao.areaList();
                            for (Area area : list
                                    ) {
                        %>
                        <tr>
                            <td><%=area.getId()%>
                            </td>
                            <td><%=area.getName()%>
                            </td>
                            <td>
                                <a href="deleteArea?id=<%=area.getId()%>">删除</a>
                                <a href="updateArea.jsp?id=<%=area.getId()%>">更改信息</a>
                                <script>
                                    $(function () {
                                        $('#updateModal').modal('hide')
                                    });
                                </script>


                            </td>
                        </tr>
                        <%
                            }
                        %>
                    </table>
                </div>
            </div>

            <footer><p>Copyright &copy; 2016.Company name All rights reserved.</p></footer>
        </div>
    </div>
    <!-- /. PAGE INNER  -->
</div>
<!-- /. PAGE WRAPPER  -->
<!-- /. WRAPPER  -->
<!-- JS Scripts-->
<!-- jQuery Js -->
<script src="assets/js/jquery-1.10.2.js"></script>
<!-- Bootstrap Js -->
<script src="assets/js/bootstrap.min.js"></script>
<!-- Metis Menu Js -->
<script src="assets/js/jquery.metisMenu.js"></script>
<!-- Custom Js -->
<script src="assets/js/custom-scripts.js"></script>

</body>
</html>
